home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / CBGRX100.ARJ / GRXFILE.H < prev    next >
Text File  |  1992-04-10  |  4KB  |  123 lines

  1. /** 
  2.  ** GRXFILE.H 
  3.  **
  4.  **  Copyright (C) 1992, Csaba Biegl
  5.  **    820 Stirrup Dr, Nashville, TN, 37221
  6.  **    csaba@vuse.vanderbilt.edu
  7.  **
  8.  **  This file is distributed under the terms listed in the document
  9.  **  "copying.cb", available from the author at the address above.
  10.  **  A copy of "copying.cb" should accompany this file; if not, a copy
  11.  **  should be available from where this file was obtained.  This file
  12.  **  may not be distributed without a verbatim copy of "copying.cb".
  13.  **  You should also have received a copy of the GNU General Public
  14.  **  License along with this program (it is in the file "copying");
  15.  **  if not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  16.  **  Cambridge, MA 02139, USA.
  17.  **
  18.  **  This program is distributed in the hope that it will be useful,
  19.  **  but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  **  GNU General Public License for more details.
  22.  **/
  23.  
  24. #ifndef _GRXFILE_H_
  25. #define _GRXFILE_H_
  26.  
  27. #if defined(__GNUC__) && !defined(near)
  28. # define near
  29. # define far
  30. # define huge
  31. #endif
  32.  
  33. #define  FONT_MAGIC    0x19590214L
  34. #define  FONTDIR_MAGIC  0x19270104L
  35. #define  CURSOR_MAGIC    0x18480315L
  36. #define  BITMAP_MAGIC    0x19390901L
  37. #define  PIXMAP_MAGIC    0x19700302L
  38. #define  ICON_MAGIC    0x19840728L
  39. #define  RGBDIR_MAGIC    0x19561023L
  40.  
  41. /*
  42.  * font file structure:
  43.  *    +-----------------------+
  44.  *    |     MAGIC NUMBER    |
  45.  *    +-----------------------+
  46.  *    |     FONT HEADER    |
  47.  *    +-----------------------+
  48.  *    |     PROPORTIONAL    |
  49.  *    |     WIDTH TABLE    |
  50.  *    |     (16 bit ints)    |
  51.  *    |     (optional)    |
  52.  *    +-----------------------+
  53.  *    |     BITMAP        |
  54.  *    +-----------------------+
  55.  */
  56.  
  57. typedef struct {
  58.     long    magic;            /* magic number */
  59.     long    bitmapsize;            /* size of the bitmap */
  60.     GrFont  h;                /* font header */
  61. } FntFileHdr;
  62.  
  63. /*
  64.  * font directory file structure:
  65.  *    +-----------------------+
  66.  *    |   MAGIC NUMBER    |
  67.  *    +-----------------------+
  68.  *    |   # OF ENTRIES    |
  69.  *    +-----------------------+
  70.  *    |   1st FONT HEADER    |
  71.  *    +-----------------------+
  72.  *    |   2nd FONT HEADER    |
  73.  *    +-----------------------+
  74.  *    |        :        |
  75.  *    |        :        |
  76.  *    +-----------------------+
  77.  *    |   last FONT HEADER    |
  78.  *    +-----------------------+
  79.  */
  80.  
  81. typedef struct {
  82.     long    magic;            /* magic number */
  83.     long    numentries;            /* # of GrFont structures in file */
  84. } FntDirHdr;
  85.  
  86. #define FNTENV  "GRXFONT"        /* font path environment variable */
  87. #define FNTEXT  ".fnt"            /* font file extension */
  88. #define DIREXT  ".dir"            /* font directory file extension */
  89. extern  char    _GrFontPath[];        /* user specified font path */
  90.  
  91. /*
  92.  * loaded resource list management
  93.  */
  94. typedef struct _reslist {        /* list of loaded resources */
  95.     struct _reslist *next;        /* next item */
  96.     void   *data;            /* the resource */
  97.     char   name[1];            /* full path name to the resource */
  98. } ResList;
  99.  
  100. extern void  _GrAddToResList(void *data,char *name,ResList **list);
  101. extern void  _GrRemoveFromResList(void *data,ResList **list);
  102. extern void *_GrLookupInResList(char *name,ResList *list);
  103.  
  104.  
  105. /*
  106.  * file utilities
  107.  */
  108. extern void  _GrSetPath(char *name,char *pathbuffer);
  109. extern char *_GrGetFname(char *name,char *path,char *env,char *ext,char *where);
  110. extern int   _GrFileOpen(char *name);
  111. extern void  _GrFileClose(int handle);
  112.  
  113. #ifdef __GNUC__
  114. # define _GrFarRead(file,buff,size)    read(file,buff,(int)size)
  115. #endif
  116.  
  117. #ifdef __TURBOC__
  118.   extern long _GrFarRead(int file,void far *buff,long size);
  119. #endif
  120.  
  121. #endif /* whole file */
  122.  
  123.